import { ajax } from '@/utils'

import {
  addProductItem,
  AnalysisItem,
  backgroundInfo,
  editCopyWriting,
  ExpressBottomItem,
  systemInfo,
  timesItem
} from './aiTestSkinTypes'
const baseUrl = '/yswy-aicefu-manage-service'

export default {
  /**检测文案配置查询 */
  getCopyWriting(data): Promise<editCopyWriting> {
    return ajax.post(`${baseUrl}/copywriter/config/select/writer`, data)
  },
  /**检测文案配置启用禁用 */
  getDisableEnable(data): Promise<any> {
    return ajax.post(`${baseUrl}/copywriter/config/switchStatus`, data)
  },
  /**检测文案配置编辑 */
  editDetectionCopy(data): Promise<any> {
    return ajax.post(`${baseUrl}/copywriter/config/editDetectionCopy`, data)
  },
  /**检测文案配置编辑查询 */
  getDetectionCopyList(id: any): Promise<any> {
    return ajax.post(
      `${baseUrl}/copywriter/config/select/editDetectionCopy/${id}`
    )
  },
  /**检测文案配置恢复默认 */
  restoreDDefault(): Promise<any> {
    return ajax.post(`${baseUrl}/copywriter/config/restoredefault`)
  },
  /**查询系统设置 */
  getSystemSettings(): Promise<systemInfo> {
    return ajax.post(`${baseUrl}/configuration/select/systemConfig`)
  },
  /**更改系统设置 */
  editSystemSettings(data): Promise<any> {
    return ajax.post(`${baseUrl}/configuration/update/systemConfig`, data)
  },
  /**查询首页背景 */
  getBackgroundConfig(): Promise<backgroundInfo> {
    return ajax.post(`${baseUrl}/configuration/select/index/background/config`)
  },
  /*更改首页背景 */
  editBackgroundConfig(data): Promise<any> {
    return ajax.post(
      `${baseUrl}/configuration/update/index/background/config`,
      data
    )
  },
  /*检测报告底部广告查询 */
  BottomPictureInfo(): Promise<ExpressBottomItem> {
    return ajax.post(`${baseUrl}/bottom/picture/select/info`)
  },
  /*检测报告底部广告禁用启用 */
  BottomPictureDisable(data): Promise<any> {
    return ajax.post(`${baseUrl}/bottom/picture/disable`, data)
  },
  /*检测报告底部广告删除 */
  BottomPictureDelete(id: any): Promise<any> {
    return ajax.post(`${baseUrl}/bottom/picture/delete/${id}`)
  },
  /*检测报告底部广告新增 */
  getBottomPicture(data: any): Promise<any> {
    return ajax.post(`${baseUrl}/bottom/picture/add`, data)
  },
  /*产品配置列表 */
  getProductList(data: any): Promise<any> {
    return ajax.post(`${baseUrl}/product/config/select/product`, data)
  },
  /*产品配置批量删除 */
  getProductDelete(data: any): Promise<any> {
    return ajax.post(`${baseUrl}/product/config/delete`, data)
  },
  /*产品配置单个删除 */
  getProductSingleDelete(id: any): Promise<any> {
    return ajax.post(`${baseUrl}/product/config/delete/${id}`)
  },
  /*产品配置新增 */
  getAddProduct(data): Promise<addProductItem> {
    return ajax.post(`${baseUrl}/product/config/add/product`, data)
  },
  /*产品配置编辑 */
  editUpdateProduct(data): Promise<addProductItem> {
    return ajax.post(`${baseUrl}/product/config/update`, data)
  },
  /*产品配置编辑查询 */
  editProductConfig(id: any): Promise<addProductItem> {
    return ajax.post(`${baseUrl}/product/config/select/${id}`)
  },
  /*测肤数据统计列表 */
  getAnalysisList(data): Promise<any> {
    return ajax.post(`${baseUrl}/face/analysisStatistics`, data)
  },
  /*测肤数据统计批量删除 */
  getAnalysisDelete(data): Promise<any> {
    return ajax.post(`${baseUrl}/face/deleteAnalysisStatistics`, data)
  },
  /*测肤数据统计 */
  getAnalysisTestList(): Promise<timesItem> {
    return ajax.post(`${baseUrl}/face/dataAnalysisStatistics`)
  },
  /*测肤数据统计导出 */
  getAnalysisExport(data) {
    return ajax.post(`${baseUrl}/face/exportAnalysisStatistics`, data, {
      responseType: 'blob',
      withResponse: true
    })
  },
  /*测肤数据统计导出 */
  getAnalysisDetails(data): Promise<AnalysisItem> {
    return ajax.post(`${baseUrl}/face/query/details`, data)
  }
}
